package com.example.demo.base;

import java.util.List;


public interface BaseService<T> {

  T insertEntity(UpdateBuilder<T> cudBuilder);

  T insertEntity0(T entity);

  /**
   * 批量新增
   * @param entities 新增实体集合
   * */
  boolean insertEntities(List<T> entities);

  /**
   * 批量新增
   * @param entities 新增实体集合
   * @param flushSize 分批提交大小
   * */
  boolean insertEntities(List<T> entities, Integer flushSize);

  boolean updateEntity(UpdateBuilder<T> updateBuilder);

  T selectEntity(QueryBuilder queryBuilder);

  T selectEntity0(T entity);

  List<T> selectEntities(QueryBuilder queryBuilder);

  List<T> selectEntities0(T entity);

  Pageable<T> selectEntitiesByPage(QueryBuilder queryBuilder, Integer pageNum, Integer pageSize);

  Pageable<T> selectEntitiesByPage(QueryBuilder queryBuilder, Integer pageNum, Integer pageSize, String orderByField, boolean isAsc);

  Pageable<T> selectEntitiesByPage0(T entity, Integer pageNum, Integer pageSize);

  Integer count(QueryBuilder queryBuilder);

  Integer count0(T entity);

  List<T> selectEntitiesByRandom(QueryBuilder queryBuilder, Integer size);

  List<T> selectEntitiesByRandom(QueryBuilder queryBuilder, Integer size, Integer seed);

  List<T> selectEntitiesByRandom0(T entity, Integer size);

  List<T> selectEntitiesByRandom0(T entity, Integer size, Integer seed);

}
